/**
 * 
 */
package com.brainstrongtech.bfs.dto;

import com.brainstrongtech.bfs.domian.Role;
import com.brainstrongtech.bfs.util.ObjectUtils;

/**
 * 
 * @Description:
 * @author: tianhua.xie
 * @Date: 2017年4月13日 上午12:41:31 
 * 
 */
public class RoleDTO {

	private Integer roleId; // 角色ID
	private String roleName;// 角色名称
	private String roleRemark;// 角色备注
	private Boolean selected;// 是否选中

	public Integer getRoleId() {
		return roleId;
	}

	public String getRoleName() {
		return roleName;
	}

	public String getRoleRemark() {
		return roleRemark;
	}

	public Boolean getSelected() {
		return selected;
	}

	public void setRoleId(Integer roleId) {
		this.roleId = roleId;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public void setRoleRemark(String roleRemark) {
		this.roleRemark = roleRemark;
	}

	public void setSelected(Boolean selected) {
		this.selected = selected;
	}

	@Override
	public String toString() {
		return "RoleDTO [roleId=" + roleId + ", roleName=" + roleName + ", roleRemark=" + roleRemark + ", selected="
				+ selected + "]";
	}

	/**
	 * 将数据模型Role转成数据传输对象
	 * 
	 * @param role
	 * @return
	 */
	public static RoleDTO parseUserMgrDTo(Role role) {

		if (ObjectUtils.isBlank(role)) {
			return null;
		}

		RoleDTO roleDTO = new RoleDTO();
		roleDTO.setRoleId(role.getRoleId());
		roleDTO.setRoleName(role.getRoleName());
		roleDTO.setRoleRemark(role.getRoleRemark());

		return roleDTO;
	}

	/**
	 * 将数据模型Role转成数据传输对象
	 * 
	 * @param role
	 * @param selected
	 * @return
	 */
	public static RoleDTO parseUserMgrDTo(Role role, Boolean selected) {

		if (ObjectUtils.isBlank(role)) {
			return null;
		}

		RoleDTO roleDTO = new RoleDTO();
		roleDTO.setRoleId(role.getRoleId());
		roleDTO.setRoleName(role.getRoleName());
		roleDTO.setRoleRemark(role.getRoleRemark());
		roleDTO.setSelected(selected);

		return roleDTO;
	}

}
